//
// Created by Administrator on 2025-07-24.
//

#pragma once

#include <iostream>
#include <map>
#include "MysqlData.h"

class MySQLHandler
{
public:
    MySQLHandler(const std::string &host, const std::string &user, const std::string &password,
                 const std::string &database);

    ~MySQLHandler();

    // 查一条记录
    MysqlData queryRecord(const std::string &sSql);

    // 插入一条记录
    void insertRecord(const std::string &tableName, const std::map<std::string, std::string> &values);

    // 修改某个字段数据
    void updateRecord(const std::string &tableName, const std::map<std::string, std::string> &setValues, const std::string &whereClause);

    // 删除记录
    void deleteRecord(const std::string &tableName, const std::string &whereClause);

};
